/*
 * semantic.h
 *
 */

#ifndef SEMANTIC_H
#define SEMANTIC_H



void create_variables(struct class_list_t *cl, int scope, int pass_number);
void set_expression_data(struct expression_data_t *ed, 
			 char *typename,
			 float val);
void create_variables_from_variable_declaration_list(struct variable_declaration_list_t *vdl, char *class, char *name_it_cannot_hold, int scope, int creating_variables_in_class, int pass_number);
void create_functions(struct class_list_t *cl, int scope, int pass_number);
void check_type_denoter(int line_no,
			struct type_denoter_t *td);
void check_type_denoter_valid(int line_no,
			      struct type_denoter_t *td);
void check_type_denoter_elements_exist(int line_no,
				       struct type_denoter_t *td);
void check_if_used_variables_are_declared(struct statement_sequence_t *ss,
					  char *class,
					  char *name_it_cannot_hold,
					  int scope,
					  int pass_number,
					  int *function_return_value_set);
void check_used_variables_in_statement(struct statement_t *s,
				       char *class,
				       char *name_it_cannot_hold,
				       int scope,
				       int pass_number,
				       int *function_return_value_set);
int check_used_variables_in_variable_access(int line_no,
					    struct variable_access_t *va,
					    char *class,
					    char *name_it_cannot_hold,
					    int scope,
					    int pass_number,
					    int in_left_hand_side,
					    int *function_return_value_set,
					    char **class_to_check,
					    int depth);
void check_used_variables_in_indexed_variable(int line_no,
					      struct indexed_variable_t *iv,
					      char *class,
					      char *name_it_cannot_hold,
					      int scope,
					      int pass_number,
					      int in_left_hand_side,
					      int *function_return_value_set,
					      char **class_to_check,
					      int depth);
void check_used_variables_in_index_expression_list(
				int line_no,
				struct index_expression_list_t *iel,
				char *class,
				char *name_it_cannot_hold,
				int scope,
				int pass_number,
				int in_left_hand_side,
				int *function_return_value_set);
int check_used_variables_in_expression(int line_no,
				       struct expression_t *e,
				       char *class,
				       char *name_it_cannot_hold,
				       int scope,
				       int pass_number,
				       int in_left_hand_side,
				       int *function_return_value_set);
int check_used_variables_in_simple_expression(int line_no,
					      struct simple_expression_t *se,
					      char *class,
					      char *name_it_cannot_hold,
					      int scope,
					      int pass_number,
					      int in_left_hand_side,
					      int *function_return_value_set);
int check_used_variables_in_term(int line_no,
				 struct term_t *t,
				 char *class,
				 char *name_it_cannot_hold,
				 int scope,
				 int pass_number,
				 int in_left_hand_side,
				 int *function_return_value_set);
int check_used_variables_in_factor(int line_no, 
				   struct factor_t *f,
				   char *class,
				   char *name_it_cannot_hold,
				   int scope,
				   int pass_number,
				   int in_left_hand_side,
				   int *function_return_value_set);
int check_used_variables_in_primary(int line_no,
				    struct primary_t *p,
				    char *class,
				    char *name_it_cannot_hold,		     
				    int scope,
				    int pass_number,
				    int in_left_hand_side,
				    int *function_return_value_set);
void semantic_analysis(struct program_t *p);
void process_function_heading(int line_no,
			      struct function_heading_t *fh,
			      char *class,
			      int scope,
			      int pass_number);
int check_types_simple_expression(struct simple_expression_t *se1,
				  struct simple_expression_t *se2);
int check_types_term(struct term_t *t1,
		     struct term_t *t2);
int check_types(struct expression_data_t *ed1,
		struct expression_data_t *ed2);
int check_types_types(char *type1, char *type2);
int check_types_structurally_equivalent_arrays(char *type1, char *type2);
int check_structurally_equivalent_classes(char *type1, char *type2);
int check_variable_tf(char *name);



#endif /* SEMANTIC_H */
